<?php

namespace App\Models\User;

use App\Models\BaseModel;

/**
 * App\Models\User\Invoice
 *
 * @property int $id
 * @property int $user_id 用户ID
 * @property int $invoice_type 1个人  2增值税普通发票   3增值税专用发票
 * @property int $invoice_content_type 发票内容 1:商品明细 2:网络服务费
 * @property string $invoice_amount 开票金额
 * @property string $invoice_id_num 证件号码 1:个人=身份证号 2:公司=纳税人识别号
 * @property string|null $invoice_title 抬头
 * @property string|null $register_address 注册地址
 * @property string|null $register_tel 注册电话
 * @property string|null $register_bank 开户银行
 * @property string|null $register_bank_num 开户行账户
 * @property string|null $receiver_name 收票人姓名
 * @property string|null $receiver_email 收票人邮箱
 * @property string|null $receiver_mobile 收票人电话
 * @property string|null $receiver_address 收票人地址
 * @property string|null $invoice_code 发票代码
 * @property string|null $invoice_number 发票号码
 * @property string|null $invoice_img 发票图片
 * @property int $status 开票状态 0:申请 1:通过 2:驳回
 * @property string|null $email_send_time 邮件发送时间
 * @property string|null $remarks 备注
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Member\Member[] $email
 * @property-read int|null $email_count
 * @property-read \Illuminate\Notifications\DatabaseNotificationCollection|\Illuminate\Notifications\DatabaseNotification[] $notifications
 * @property-read int|null $notifications_count
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice query()
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice whereEmailSendTime($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice whereInvoiceAmount($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice whereInvoiceCode($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice whereInvoiceContentType($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice whereInvoiceIdNum($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice whereInvoiceImg($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice whereInvoiceNumber($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice whereInvoiceTitle($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice whereInvoiceType($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice whereReceiverAddress($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice whereReceiverEmail($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice whereReceiverMobile($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice whereReceiverName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice whereRegisterAddress($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice whereRegisterBank($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice whereRegisterBankNum($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice whereRegisterTel($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice whereRemarks($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice whereStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Invoice whereUserId($value)
 * @mixin \Eloquent
 */
class Invoice extends BaseModel {

	protected $table = 'invoice';
	protected $fillable = [
		'user_id',
		'invoice_type',
		'invoice_content_type',
		'invoice_amount',
		'invoice_id_num',
		'invoice_title',
		'register_address',
		'register_tel',
		'register_bank',
		'register_bank_num',
		'receiver_name',
		'receiver_email',
		'receiver_mobile',
		'receiver_address',
		'invoice_code',
		'invoice_number',
		'invoice_img',
		'status',
		'email_send_time',
		'remarks'
	];

	//关系表
	public function email() {
		return $this->hasMany( 'App\Models\Member\Member', 'id', 'user_id' );
	}
}
